﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Interfaces
{
    #region Delegates

    public delegate void NewAbsoluteDataAvailableHandler(object sender, IAbsoluteData data);
    public delegate void NewCellDataAvailableHandler(object sender, CellData data);
    public delegate void NewPairedDataAvailableHandler(object sender, IAbsoluteData absoluteData, IProximityData proximityData);
    public delegate void NewWifiDataAvailableHandler(object sender, WifiData[] data);
    public delegate void ContextChangedHandler(object sender);
    public delegate void ContextMatchesHandler(object sender, int id, short relevance);

    #endregion

    public interface IMiddleware : ICommonInterface
    {
        event NewAbsoluteDataAvailableHandler NewAbsoluteDataAvailable;
        event NewCellDataAvailableHandler NewCellDataAvailable;
        event NewWifiDataAvailableHandler NewWifiDataAvailable;
        event NewPairedDataAvailableHandler NewPairedDataAvailable;
        event ContextChangedHandler ContextChanged;

        #region Marker methods

        //Define all the methods that can be called by the plugin applications here

        /*
         * // TODO: Implement these
         * 
        /// <summary>
        /// Replace the marker with the given id to the specified position
        /// </summary>
        /// <param name="id">Identifier of the marker to replace</param>
        /// <param name="lat">New latitude of the marker</param>
        /// <param name="lon">New longitude of the marker</param>
        /// <param name="label">New label of the marker</param>
        /// <param name="Plugin">Type of the owner Plugin to guarantee exclusive access</param>
        /// <returns>True, if the replacement was successful, otherwise false</returns>
        bool ChangeMarker(int id, float lat, float lon, string label, IApplication Plugin);

        bool DeleteMarker(int id, IApplication Plugin);
        int DeleteMarker(float lat, float lon, float radius, IApplication Plugin);
        
        
        */
        int CreateTemplate(System.IO.Stream background, System.Drawing.Point imageOffset, System.Drawing.Point offset, string owner);

        int NewMarker(double latitude, double longitude, int proto_id, string text, System.Drawing.Bitmap image);
        bool MoveMarker(int marker_id, double latitude, double longitude);

        #endregion

        #region Event methods

        /// <summary>
        /// Creates a proximity-based event from the current proximity data
        /// </summary>
        /// <param name="eventHandler">Method to be called when the event occurs</param>
        /// <returns>true, if the creation was successful</returns>
        int CreateEvent(string description, short minRelevance, ContextMatchesHandler eventHandler, PositionOriginator[] originators);
        int CreateEvent(string description, short minRelevance, ContextMatchesHandler eventHandler, string[] members);
        bool MergeEvent(int id, string[] members);
        bool RemoveEvent(int id);
        string[] GetCurrentContext(PositionOriginator[] originators);

        #endregion
    }
}
